package com.attendance.controller;


import com.attendance.common.CommonResult;
import com.attendance.pojo.Pages;
import com.attendance.pojo.Student;
import com.attendance.service.impl.StudentServiceImpl;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.net.URLEncoder;
import java.util.UUID;


@RestController
@RequestMapping("/studentInfo")
public class StudentController {

    @Autowired
    private StudentServiceImpl studentService;
    //   根据条件查学生信息
    @GetMapping("/selectStudent")
    public CommonResult selectStudent(Pages page,Student student){
        return studentService.selectStudent(student,page);
    }

    //    根据学生id查学生
    @GetMapping("/selectStudentById")
    public CommonResult selectStudentById(int id){
        return studentService.selectStudentById(id);
    }

    //    更新学生基本信息
    @PostMapping("/updateStudentInfo")
    public CommonResult updateStudentInfo(@RequestBody Student student){
        return studentService.updateStudentInfo(student);
    }

    //    更改学生状态
    @PostMapping("/modifyStudentStatus")
    public CommonResult modifyStudentStatus(@RequestBody Student student){
        return studentService.modifyStudentStatus(student);
    }

    //    新增学生信息
    @PostMapping("/addStudentInfo")
    public CommonResult addStudentInfo(@RequestBody Student student){
        return studentService.addStudentInfo(student);
    }

    //根据课程id查询学生
    @PostMapping("/selectStudentInfoByCourseId")
    public CommonResult selectStudentInfoByCourseId(int id, Pages pages){
        return studentService.selectStudentInfoByCourseId(id,pages);
    }

    @PostMapping("/upLoadImg")
    public CommonResult upLoadImg(MultipartFile myfile,int id){
        return studentService.upLoadImg(myfile,id);
    }



}
